package guda.house.biz.form;

import guda.house.biz.util.ArrayUtil;
import guda.house.dal.dataobject.AdminDO;

import javax.validation.constraints.NotNull;


/**
 * Created by well on 15/11/7.
 */
public class AdminEditForm extends AdminForm{

    @NotNull(message = "不能为空")
    private Long adminId;

    public Long getAdminId() {
        return adminId;
    }

    public void setAdminId(Long adminId) {
        this.adminId = adminId;
    }

    public void initForm(AdminDO adminDO){
        if(adminDO == null){
            return ;
        }
        setLoginName(adminDO.getLoginName());
        setLoginPassword(adminDO.getLoginPassword());
        setCertNo(adminDO.getCertNo());
        setPhone(adminDO.getPhone());
        setQq(adminDO.getQq());
        setEmail(adminDO.getEmail());
        setWeixin(adminDO.getWeixin());
        setAdminStatus(adminDO.getAdminStatus());
        setRealName(adminDO.getRealName());
        setAdminId(adminDO.getAdminId());
    }

    public AdminDO toDO() {
        AdminDO adminDO = super.toDO();
        adminDO.setAdminId(adminId);
        return adminDO;
    }
}
